using System.Collections.Generic;
using System.Linq;
using ControleRepresentante.Logic.Models;

namespace WebSite.ViewModels.IndexViewModels
{
    public abstract class UsuariosHolderIndexViewModel<TModel> : DetailsHolderIndexViewModel<TModel>
        where TModel : DetailsHolder
    {
        private readonly bool m_CanCreatePedido;

        protected UsuariosHolderIndexViewModel(string title, bool canCreatePedido)
            : base(title)
        {
            m_CanCreatePedido = canCreatePedido;
        }
        protected override IEnumerable<ButtonType> ButtonTypes(TModel modelBase)
        {
            List<ButtonType> buttonTypes = base.ButtonTypes(modelBase).ToList();
            if (m_CanCreatePedido)
            {
                buttonTypes.Add(ButtonType.CreatePedido);
            }
            return buttonTypes;
        }
    }
}